package com.yunhe.mybatis.web.deparment;

import com.yunhe.mybatis.entity.Deparment;
import com.yunhe.mybatis.service.DeparmentService;
import com.yunhe.mybatis.service.impl.DeparmentServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/deparment/d/update")
public class Update extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
       req.setCharacterEncoding("UTF-8");

        //从list页面中拿的数据 带入到
        Integer parameter = Integer.valueOf(req.getParameter("deparmentId"));
        DeparmentService deparmentService = new DeparmentServiceImpl();

        Deparment deparment = deparmentService.find(parameter);

        req.setAttribute("parameterId",deparment);

        req.getRequestDispatcher("/WEB-INF/deparment/update.jsp").forward(req,resp);
    }
}
